package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.ConditionsInfoMapper;
import com.ttg.model.pojo.ConditionsInfo;
import com.ttg.model.vo.ConditionsInfoVO;
import com.ttg.web.dao.ConditionsInfoDao;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZQ
 * @version 1.0
 * @Description
 * @date 2021/1/26 13:26
 */
@Service
public class ConditionsInfoDaoImpl extends ServiceImpl<ConditionsInfoMapper, ConditionsInfo> implements ConditionsInfoDao {


    @Override
    public List<ConditionsInfo> findByTagId(Long TagId) {
        LambdaQueryWrapper<ConditionsInfo> wrapper =new LambdaQueryWrapper<>();
        wrapper.eq(ConditionsInfo::getTagId,TagId);
        return list(wrapper);
    }

    @Override
    public List<ConditionsInfoVO> findConditionsByTagId(Long tagId) {
        return baseMapper.findConditionsByTagId(tagId);
    }


    @Override
    public List<ConditionsInfoVO> findByTagIdAndGroupNo(Long tagId, String groupNo) {
        return baseMapper.findByTagIdAndGroupNo(tagId,groupNo);
    }

    @Override
    public void removeByTagId(Long tagId) {
        LambdaQueryWrapper<ConditionsInfo> wrapper =new LambdaQueryWrapper<>();
        wrapper.eq(ConditionsInfo::getTagId,tagId);
        remove(wrapper);
    }


}
